package com.ieslab.powergrid.demosvr.thread;

import com.ieslab.powergrid.demosvr.service.ThreadServiceDemo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ApplicationRunnerImpl implements ApplicationRunner {
    @Autowired
    ThreadServiceDemo threadServiceDemo;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("通过实现ApplicationRunner接口，在spring boot项目启动后打印参数");
        //可以在这里启动你的业务线程
        if(!ThreadServiceDemo.runFlag){
            ThreadServiceDemo.runFlag = true;
            //threadServiceDemo.findPersonTest();
        }

    }
}
